package cn.kxhp.mybatis3.dao.mapper.base;

import cn.kxhp.mybatis3.entity.User;
import org.apache.ibatis.annotations.*;

/**
 * @author Lianxw
 * @since 2022/3/29
 */
@Mapper
public interface UserMapper {

    @Results(id = "userBaseResultMap", value = {
            @Result(column = "id", property = "id", id = true),
            @Result(column = "uid", property = "uid"),
            @Result(column = "username", property = "username"),
            @Result(column = "phone", property = "phone"),
            @Result(column = "password", property = "password"),
            @Result(column = "status", property = "status"),
            @Result(column = "created_by", property = "createdBy"),
            @Result(column = "created_at", property = "createdAt"),
            @Result(column = "updated_at", property = "updatedAt")
    })
    @Select("u.id, u.uid, u.username, u.phone, u.`password`, u.`status`, u.created_at, u.created_by, u.updated_at " +
            "FROM infra_user AS u where u.id=#{id}")
    User selectById(@Param("id") Long id);

}
